package com.ipartek.pruebas.bbddaccessP5;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class OBDCDAOFactoryP5 extends DAOFactoryP5{
	
	static final String DRIVER  = "sun.jdbc.odbc.JdbcOdbcDriver";
	static final String CON_URL = "jdbc:odbc:pruebas";
	static final String USER    = "";
	static final String PASS    = "";
	

	public OBDCDAOFactoryP5() {
		try{
		Class.forName( DRIVER );
		}catch(ClassNotFoundException e){
			e.printStackTrace();
		}
	}
	
	public static Connection getConnection(){
		Connection con = null;
		try{
			
			con = DriverManager.getConnection( CON_URL, USER , PASS );
			
		}catch(SQLException e){
			e.printStackTrace();
			System.out.println( "DRIVER  = "+ DRIVER );
			System.out.println( "CON_URL = "+ CON_URL );
			System.out.println( "USER    = "+ USER );
			System.out.println( "PASS    = "+ PASS );
		}
		return con;
	}
	
	@Override
	public AlumnoDAOP5 getAlumno() {
		return new AlumnoOBDDACDAOP5();
	}

	@Override
	public CursoDAOP5 getCurso() {
		return new CursoOBDCDAOP5();
	}

}
